package com.ywy.chat.handler.filter;

import lombok.Data;
import org.tio.core.ChannelContext;
import org.tio.core.ChannelContextFilter;

/**
 * 通道过滤器
 *
 * @author ywy
 * @date 2021/12/31 17:05
 */
@Data
public class ExcludeMineChannelContextFilter implements ChannelContextFilter {
    private ChannelContext currentContext;

    @Override
    public boolean filter(ChannelContext channelContext) {
        // 过滤当前用户，不发消息给自己
        if (currentContext.userid.equals(channelContext.userid)) {
            return false;
        }
        return true;
    }
}
